var home = new Vue({
    el:'#app',
    data () {
        return{
            isShow1: false,
            isShow2: false,
            isShow3: false,
            isShow4: false,
            isShow5: false,
            isShow6: false,
            isShow7: false,
            num: 0,
            picArr: ["./picture/home5.png","./picture/pic_banner.png","./picture/news_banner.jpg"]
        }
    },
    methods:{
        btnLeft () {
            if(this.num == 0) {
                this.num = this.picArr.length - 1
            }
            else{
                 this.num--
            }
        },
        btnRit () {
            if(this.num == this.picArr.length - 1) {
                this.num = 0
            }
            else{
                this.num++
            }
        },
        windowScroll () {
            var photo = document.getElementById('photo').offsetTop
            var img1 = document.getElementById('business_logo1').offsetTop
            /* console.log(img1) */
            var img2 = document.getElementById('business_logo2').offsetTop
            var img3 = document.getElementById('business_logo3').offsetTop
            var img4 = document.getElementById('business_logo4').offsetTop
            var img5 = document.getElementById('business_logo5').offsetTop
            var img6 = document.getElementById('business_logo6').offsetTop
            let scrollTop =
                window.pageYOffset ||
                document.documentElement.scrollTop ||
                document.body.scrollTop;
            /* console.log(scrollTop) */
            /* var opacity1 = Math.abs(Math.round(scrollTop)) / img1; */
            var opacity1 = Math.abs(scrollTop - img1)
            if (opacity1 <= 600) {
                this.isShow1 = true
            }
            var opacity2 = Math.abs(scrollTop - img2)
            if (opacity2 <= 600) {
                this.isShow2 = true
            }
            var opacity3 = Math.abs(scrollTop - img3)
            if (opacity3 <= 600) {
                this.isShow3 = true
            }
            var opacity4 = Math.abs(scrollTop - img4)
            if (opacity4 <= 600) {
                this.isShow4 = true
            }
            var opacity5 = Math.abs(scrollTop - img5)
            if (opacity5 <= 600) {
                this.isShow5 = true
            }
            var opacity6 = Math.abs(scrollTop - img6)
            if (opacity6 <= 600) {
                this.isShow6 = true
            }
            var opacity7 = Math.abs(scrollTop - photo)
            if (opacity7 <= 600) {
                this.isShow7 = true
            }
            },
        destroyed () {
            window.removeEventListener('scroll', this.windowScroll); //销毁滚动事件
        }
        },
        mounted(){
            window.addEventListener('scroll', this.windowScroll)
            setInterval(this.btnRit, 5000);
        }
})